#include <stdio.h>
#include <stdlib.h> 
struct node {
	int data;
	struct node* next;
};
typedef struct node* List;
List read()
{
	List L, head;
	L = (List)malloc(sizeof(struct node));
	L->next = NULL;
	head = L;
	int n;
	while (scanf("%d", &n) != EOF && n >= 0)
	{
		List q = (List)malloc(sizeof(struct node));
		q->data = n;
		q->next = NULL;
		head->next = q;
		head = q;
	}
	return L;
}
void func(List L, int p)
{
	int lenth = 0;
	List t = L->next;
	while (t) {
		lenth++;
		t = t->next;
	}
	int num = lenth - p;

	if (num < 0) {
		printf("NULL");
		return;
	}
	t = L->next;
	while (num--)
	{
		t = t->next;
	}
	printf("%d", t->data);

}
int main()
{
	int K;
	scanf("%d", &K);
	List L;
	L = (List)malloc(sizeof(struct node));
	L = read();
	func(L, K);
	return 0;
}